<!-- BEGIN NEWS FORM -->
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'members-form',
	'enableClientValidation'=>false,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
	'htmlOptions'=>array(
		'class'=>'horizontal-form',
		'enctype'=>'multipart/form-data'
	),
)); ?>
<div class="form-body">
    <div class="row">
        <div class="col-md-3">
            <div class="fileupload fileupload-new <?php echo ($model->getError('username') ? 'has-error' : ''); ?>" data-provides="fileupload">
				<div class="fileupload-new thumbnail" style="width: 240px; height: 150px;">
                <?php if ($model->isNewRecord) : ?>
					<img src="<?php echo Yii::app()->theme->baseUrl; ?>/img/no_image.gif" alt="" />
                <?php else : ?>
                	<img src="<?php echo $this->getImageUrl() . 'news/' . date('Ymd', strtotime($model->createddate)) . '/' . $model->image; ?>" alt="" />
                <?php endif; ?>
				</div>
				<div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 240px; max-height: 150px; line-height: 20px;"></div>
				<div>
					<span class="btn default btn-file">
						<span class="fileupload-new"><i class="icon-paper-clip"></i> Select image</span>
						<span class="fileupload-exists"><i class="icon-undo"></i> Change</span>
						<?php echo $form->fileField($model, 'image', array('class'=>'default')); ?>
					</span>
					<a href="#" class="btn red fileupload-exists" data-dismiss="fileupload"><i class="icon-trash"></i> Remove</a>
				</div>
                <?php echo $form->error($model, 'image', array('class'=>'help-block')); ?>
			</div>
        </div>
        <div class="col-md-9">
            <div class="form-group <?php echo ($model->getError('username') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'username', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'username', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'username', array('class'=>'help-block')); ?>
            </div>

            <div class="form-group <?php echo ($model->getError('email') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'email', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'email', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'email', array('class'=>'help-block')); ?>
            </div>
            <div class="form-group">
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group <?php echo ($model->getError('lname') ? 'has-error' : ''); ?>">
                            <?php echo $form->labelEx($model, 'lname', array('class'=>'control-label')); ?>
                            <?php echo $form->textField($model, 'lname', array('class'=>'form-control')); ?>
                            <?php echo $form->error($model, 'lname', array('class'=>'help-block')); ?>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group <?php echo ($model->getError('fname') ? 'has-error' : ''); ?>">
                            <?php echo $form->labelEx($model, 'fname', array('class'=>'control-label')); ?>
                            <?php echo $form->textField($model, 'fname', array('class'=>'form-control')); ?>
                            <?php echo $form->error($model, 'fname', array('class'=>'help-block')); ?>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <?php echo $form->labelEx($model, 'dateofbirth', array('class'=>'control-label')); ?>
                <div class="input-group date date-picker" data-date="<?php echo date('d-m-Y', strtotime($model->dateofbirth)); ?>" data-date-format="dd-mm-yyyy">
                    <input type="text" class="form-control" readonly id="dateofbirth" name="dateofbirth" value="<?php echo date('d-m-Y', strtotime($model->dateofbirth)); ?>">
                    <span class="input-group-btn">
                    <button class="btn default" type="button"><i class="icon-calendar"></i></button>
                    </span>
                 </div>
            </div>

            <div class="form-group <?php echo ($model->getError('address') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'address', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'address', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'address', array('class'=>'help-block')); ?>
            </div>

            <div class="form-group <?php echo ($model->getError('phone') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'phone', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'phone', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'phone', array('class'=>'help-block')); ?>
            </div>

            <div class="form-group <?php echo ($model->getError('gender') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'gender', array('class'=>'control-label')); ?>
                <?php echo $form->dropDownList($model, 'gender', array('F'=>'Nam', 'M'=>'Nữ'), array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'gender', array('class'=>'help-block')); ?>
            </div>

            <div class="form-group <?php echo ($model->getError('status') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'status', array('class'=>'control-label')); ?>
                <?php echo $form->dropDownList($model, 'status', array('A'=>'Hoạt động', 'I'=>'Ngừng hoạt động', 'P'=>'Chờ duyệt'), array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'status', array('class'=>'help-block')); ?>
            </div>
        </div>
    </div>
</div>
<div class="form-actions right">
	<button type="reset" class="btn default">Cancel</button>
	<button type="submit" class="btn blue" onClick="Custom.showLoading();"><i class="icon-ok"></i> <?php echo $model->isNewRecord ? 'Thêm' : 'Cập nhật tin'; ?></button>
</div>
<?php $this->endWidget(); ?>
<!-- END NEWS FORM -->